#include <iostream>
using namespace std;

void reverse(char *str) {
    int lenght = 0;
    while ( *(str+lenght)!='\0') lenght++;
      
    char temp;
    int begin = 0;
    int end = lenght-1;

    for (int i=0;i<lenght/2;i++){
        temp = *(str+end);
        *(str+end) = *(str+begin);
        *(str+begin) = temp;
    
        begin++;
        end--;
    }
}

int main() {
    char str[] = "lorem ipsum";
    cout << str << endl;
    reverse(str);
    cout << str << endl;
    return 0;
}
